import java.sql.SQLOutput;

/**
 * Creat by TanLei
 * Description:
 * User:86183
 * Date:2022-06-16
 * Time:13:51
 */
public class Test4 {
    public static void main(String[] args) {
        //字符串转换成int
        String str = "123";

        int a = Integer.valueOf(str);
        int b = a+1;
        System.out.println(b);

        int ret = Integer.parseInt(str);
        System.out.println(ret);
    }
    public static void main15(String[] args) {
        //int 转换成字符串有几种做法
        int a = 10;
        String str1 = a + "";
        System.out.println(str1);

        String str3 = String.valueOf(a);
        System.out.println(str3);
    }
    public static void main14(String[] args) {
        byte a = 10;
        byte b = 20;
        //byte c = a + b;  cpu是以4个字节，4个字节的取，byte先提升到int在运算
        //a -> int  b -> int
        byte c = (byte) (a + b);
        System.out.println(c);

        byte d = 10 + 20;//编译器编译的时候认为成了-> byte d = 30;
        System.out.println(d);

        final int SIZE = 10;
        int aa = 99 + SIZE;//109
        System.out.println(aa);
    }

    public static void main13(String[] args) {
        int a = 10;
        boolean flg = true;
        //a = flg;
        //flg = a;
    }

    public static void main12(String[] args) {
        int a = 10;
        long b = 19;
        // a = b;
        a = (int) b;//强制类型转换

        double d = 112.5;
        //a = d;
        float f = 2.4f;
        //a = f;
        f = a;
        d = a;

    }

    public static void main11(String[] args) {
        int a = 99;
        {
            a = 10;
        }
        System.out.println(a);
    }

    public static void main9(String[] args) {
        String str1 = "hello";
        String str2 = "abc";
        String str3 = str1 + str2;
        System.out.println(str3);
        short a = 10;
        System.out.println(Short.MAX_VALUE);
        System.out.println(Short.MIN_VALUE);
        System.out.println(Byte.MAX_VALUE);
        System.out.println(Byte.MIN_VALUE);
        System.out.println(Long.MIN_VALUE);
        System.out.println(Long.MAX_VALUE);
        System.out.println(Float.MAX_VALUE);
        System.out.println(Float.MIN_VALUE);
    }

    public static void main8(String[] args) {
        String str = "tan lei is coll";   //引用变量 str 存的是“.....” 的地址
        System.out.println(str);
        int a = 10;
        System.out.println("a = " + a);
        int b = 20;
        System.out.println("hello" + a + b);
        System.out.println(a + b + "hello");
        String str2 = "hello \"张三\" ";
        System.out.println(str2);
    }

    public static void main7(String[] args) {
        boolean flg1 = true;
        boolean flg2 = false;//jvm标准 并未说明是几个字节 没有明确的大小
    }

    public static void main6(String[] args) {
        short a = 10;
        short b = 20;
        System.out.println(Short.MAX_VALUE);
        System.out.println(Short.MIN_VALUE);
    }

    public static void main5(String[] args) {
        //byte q;  局部变量再使用的时候一定要初始化，不初始化编译不能通过
        //byte q = 200;
        byte q = 127;
        System.out.println(q);

        byte a = 10;
        byte b = 20;
        System.out.println(Byte.MAX_VALUE);
        System.out.println(Byte.MIN_VALUE);

        int i = Integer.MAX_VALUE + 1;
        System.out.println(i);

        //System.out.println(Integer.MAX_VALUE);2147483647
        int i2 = 2147483647 + 1;
        System.out.println(i2);
//给任何的数据类型赋值的时候字面值是一定不能超过这种类型的取值范围
        //int i3 = 2147483648;
        //System.out.println(i3);
    }

    public static void main4(String[] args) {
        char ch = 'a';
        char ch2 = 97;
        char ch3 = '高';
        // char ch4 = -9;

        System.out.println(ch);
        System.out.println(ch2);
        System.out.println(ch3);
        System.out.println(Character.MAX_VALUE);
        System.out.println(Character.MIN_VALUE);
    }

    public static void main3(String[] args) {
        //float f = 12.5;
        float f = 12.5f;
        System.out.println(f);
    }

    public static void main2(String[] args) {
        double d = 1.25;
        System.out.println(d);

        System.out.println(Double.MAX_VALUE);
        System.out.println(Double.MIN_VALUE);

        double num = 1.1;
        System.out.println(num * num);
    }

    public static void main1(String[] args) {
        long a = 10L;
        System.out.println(a);
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);
    }
}
